package com.ruoyi.common.core.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author: YwaiX
 * @Version: 1.0
 * @Date: Created in 2024-09-12 19:33:24
 * @Description:
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageData<T> {
    /**
     * 当前页数
     */
    private Integer page;
    /**
     * 当前页显示数据条数
     */
    private Integer size;
    /**
     * 总数据量
     */
    private Integer total;
    /**
     * 总页数
     */
    private Integer pageCount;
    /**
     * 分页数据
     */
    private List<T> data;
    
    public PageData(Integer page, Integer size, Integer total, List<T> data) {
        this.page = page;
        this.size = size;
        this.total = total;
        this.pageCount = (int) Math.ceil((double) total / size);
        this.data = data;
    }
}
